home *** CD-ROM | disk | FTP | other *** search
- Program Test__TT_32Bit;
- { This is a very simple program to demonstrate how to use the Move32 procs.
- All this program does is allocate 2 16K blocks of Heap space (P1 & P2) and
- initializes them to all 3's and 2's respectively. After each array is
- init'd the 1st 4000 bytes are moved to video page 0 (does work on mono.),
- and displys a simple message indicating which is being displayed.
-
- You will also note that when we move data from P1^ & P2^, I'm using the
- Turbo Move() procedure. This was done because almost all video boards
- in use are only 8-bit cards. If you have a decent-resolution profiler,
- you can test both 16 & 32-bit procedures against their 8-bit counterpart
- on an 8-bit device and find that real time spent to Xfer the data takes
- much longer in spite of the fact that there are more iterations with Move().
- Oh, by the way, if you still got a CGA card, you're gonna se a snow storm!
-
- If the program exits with a beep and a non-zero exit-code, then you're in
- a graphics mode, please change to a text mode (0..3, or 7) and the exit-code
- is what the machine Bios thinks is the current video mode is.
- }
- { 03 June, 1989 Written by: Thomas A. Toth, Jr.
- Copyright(c) 1989 Synergy Software Developers
- Please see documentation in TT_32Bit.pas
- }
-
- USES
- Crt,
- TT_32Bit;
-
- TYPE
- BoolText = Array[Boolean] of String[7];
-
- CONST
- NumLoops = 1; { Used in a loop using Move32(), I left it there so
- you could easily add some code to test things like
- timing comparisons, etc. }
-
- XFerMethod : BoolText = ('16-Bit','32-bit');
-
-
- VAR
- P1,
- P2 : Pointer;
- CurVMode : Byte;
- VideoSeg : WORD;
- GlbLoop : Word;
-
-
- { ThisIs() displays a message informing us which RAM Block is begin displayed }
- Procedure ThisIs(WhichPtr : String);
- begin
- GotoXY(1,1);
- Write('This is the 1st 4000 bytes of ',WhichPtr,'^. Press any key...');
- { Tell user which block of RAM we're looking at on screen }
-
- ReadLn;
- { Wait for a key, and do a CR/LF }
- end;
-
-
- Function GetVideoMode : Byte; {Inline macro, returns 7 for Mono, else Color}
- Inline($B4/$0F/$CD/$10);
-
-
- { Main Body }
- BEGIN
- { Test for Monochrome or Color active monitor }
- CurVMode:=GetVideoMode;
- If CurVMode=7 then { VideoMode=7 MONO }
- VideoSeg:=$b000
- else if CurVMode<4 then
- VideoSeg:=$B800
- else
- Begin
- WriteLn(^G);
- Halt(CurVMode);
- end;
-
- { Allocate us same Heap space }
- GetMem(P1,$3FFF);
- GetMem(P2,$3FFF);
-
- { Init P1^ to all 3's, then copy 1st $1000 bytes to Video RAM }
- FillChar(P1^,$3FF0,#3);
- ClrScr;
- Move(P1^,Mem[VideoSeg:0],$1000);
- { Use Turbo Move() when either Source or Dest is only an 8 bit device! }
-
- ThisIs('P1'); { Tell user what they're looking at }
-
- { Init P2^ to all 2's, then copy 1st $1000 bytes to Video RAM }
- FillChar(P2^,$1FF0,#2);
- Move(P2^,Mem[VideoSeg:0],$1000); { See note on Line #82 }
-
- ThisIs('P2');
-
- { Now, 1st 12K of P2^ to P1^ as fast as possible! 32-bit or 16-bit}
- { This is were you would insert your loop if using your own routines
- to time different move variations }
-
- For GlbLoop:=1 to NumLoops do { NumLoops distributed set to 1 }
- Move32(P2^,P1^,$0E00); { Move32() normally used for larger xfers }
-
- ClrScr;
-
- { Display 1st 4096 bytes of P1^ on screen }
- Move(P1^,Mem[VideoSeg:0],$1000);
-
- ThisIs('P1');
-
- FreeMem(P1,$3FFF);
- FreeMem(P2,$3FFF);
- ClrScr;
- WriteLn('80386/486 detected:= ',Has386);
- WriteLn('XFer method used := ',XFerMethod[Has386]);
- END.